import java.util.StringTokenizer;


class P486_39643 {

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}

	public static void main(String[] args) {
		String line = readLn();
		
		while (line != null) {
			process(line);
			line = readLn();
		}
	}

//	negative, zero, one, two, three, four, five, six, seven, eight, nine, ten,
//	eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen,
//	twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety, hundred,
//	thousand, million
	
//	999,999,999
	
	private static void process(String line) {
		
		if (line.equals("zero")) {
			System.out.println(0);
			return;
		}
		
		 
		
		StringTokenizer st = new StringTokenizer(line);
		
		String[] words = new String[st.countTokens()];
		
		for (int k = 0; k < words.length; k++) {
			words[k] = st.nextToken();
		}
		
		boolean negative = false;
		
		int value = 0;
		
		int multiplier = 1;
		
		int hundred = 0;
//		boolean thousand
		
		for (int k = words.length - 1; k >= 0; k--) {
			
			if (words[k].equals("negative")) {
				negative = true;
			} else {
			
//System.out.println(words[k]);				
				
				int current = get(words[k]);

//System.out.println("current: " + current);


				if (current < 100) {
					value += (current * multiplier);
				} else {
					
					if (current == 1000) {
						hundred = 1;
					} 
					
					if (current == 1000000) {
						hundred = 2;
					}
					
					if (current == 100) {
						if (hundred == 0) {
							current = 100;
						} 
						if (hundred == 1) {
							current = 100000;
						}
						if (hundred == 2) {
							current = 100000000;
						}
						
					}
					
					multiplier = current;
					
					
					
				}
//System.out.println("multiplier: " + multiplier);				
//System.out.println("value: " + value);				
			
			}
			
		}
	
		if (negative)
			System.out.print('-');
		System.out.println(value);
		
	}

private static int get(String string) {
	if (string.equals("one"))
		return 1;
	if (string.equals("two"))
		return 2;
	if (string.equals("three"))
		return 3;
	if (string.equals("four"))
		return 4;
	if (string.equals("five"))
		return 5;
	if (string.equals("six"))
		return 6;
	if (string.equals("seven"))
		return 7;
	if (string.equals("eight"))
		return 8;
	if (string.equals("nine"))
		return 9;
	if (string.equals("ten"))
		return 10;
	if (string.equals("eleven"))
		return 11;
	if (string.equals("twelve"))
		return 12;
	if (string.equals("thirteen"))
		return 13;
	if (string.equals("fourteen"))
		return 14;
	if (string.equals("fifteen"))
		return 15;
	if (string.equals("sixteen"))
		return 16;
	if (string.equals("seventeen"))
		return 17;
	if (string.equals("eighteen"))
		return 18;
	if (string.equals("nineteen"))
		return 19;
	if (string.equals("twenty"))
		return 20;
	if (string.equals("thirty"))
		return 30;
	if (string.equals("forty"))
		return 40;
	if (string.equals("fifty"))
		return 50;
	if (string.equals("sixty"))
		return 60;
	if (string.equals("seventy"))
		return 70;
	if (string.equals("eighty"))
		return 80;
	if (string.equals("ninety"))
		return 90;
	if (string.equals("hundred"))
		return 100;
	if (string.equals("thousand"))
		return 1000;
	if (string.equals("million"))
		return 1000000;
	
	System.out.println("erro! " + string);
	return 0;
}
	
	
}
